package ai.people.core.common.properties.graph;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 图变量
 *
 * @author yuanqinglong
 * @date 2022/5/9 14:30
 */
@Component
@ConfigurationProperties("nebula.graph")
public class GraphVariables {

    /**
     * tag集合
     */
    private static Set<String> tagSet;
    /**
     * 边集
     */
    private static Set<String> edgeSet;


    public void setTagSet(Set<String> tagSet) {
        GraphVariables.tagSet = tagSet;
    }


    public void setEdgeSet(Set<String> edgeSet) {
        GraphVariables.edgeSet = edgeSet;
    }

    /**
     * 获取源
     *
     * @return {@link Set}<{@link String}>
     */
    public static Set<String> getTagSet() {
        return tagSet;
    }

    /**
     * 获取边设置
     *
     * @return {@link Set}<{@link String}>
     */
    public static Set<String> getEdgeSet() {
        return edgeSet;
    }

    /**
     * 包含
     *
     * @param tagName 源名称
     * @return boolean
     */
    public static boolean containsTag(String tagName) {
        return tagSet.contains(tagName);
    }

    /**
     * 包含边
     *
     * @param edgeName 边缘名字
     * @return boolean
     */
    public static boolean containsEdge(String edgeName) {
        return edgeSet.contains(edgeName);
    }

}
